import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userData: localStorage.getItem('user') && JSON.parse(localStorage.getItem('user'))
  },
  mutations: {
    SET_USER_DATA (state, user) {
      console.log(user)
      state.userData = user
      localStorage.setItem('user', JSON.stringify(user))
    }
  },
  actions: {
  },
  modules: {
  }
})
